package com.UI
{
	import com.*;
	import com.Engine.*;
	import com.Packet.*;
	
	import flash.display.*;
	import flash.events.*;
	import flash.external.*;
	import flash.filters.*;
	import flash.geom.*;
	import flash.system.*;
	import flash.text.*;
	import flash.ui.*;
	import flash.utils.*;
	
	import gs.*;
	import gs.easing.*;
	import gs.events.TweenEvent;
	
	import org.aswing.*;
	import org.aswing.border.*;
	import org.aswing.border.EmptyBorder;
	import org.aswing.colorchooser.*;
	import org.aswing.dnd.*;
	import org.aswing.event.*;
	import org.aswing.ext.*;
	import org.aswing.geom.*;
	import org.aswing.tree.AbstractLayoutCache;
	
	public class FrameSelectLine extends JFrame
	{
		//members define
		private var panel71:JPanel;
		private var _btn_line0:JButton;
		private var _btn_line1:JButton;
		private var _btn_line2:JButton;
		private var _btn_line3:JButton;
		private var _btn_line4:JButton;
		private var _btn_line5:JButton;
		private var _btn_line6:JButton;
		private var _btn_line7:JButton;
		private var _btn_line8:JButton;
		private var _btn_line9:JButton;
		private var panel74:JPanel;
		private var btn_line_auto:JButton;
		private var btn_line_cancel:JButton;
		
		
		public function FrameSelectLine()
		{
			super();
			setClosable(false);
			setResizable(false);  
			setBorder(new EmptyBorder());
			this.getTitleBar().setMinimizeHeight(32);
			
			//component creation
			setSize(new IntDimension(136, 275));
			setPreferredSize(new IntDimension(136, 275));
			var layout0:EmptyLayout = new EmptyLayout();
			getContentPane().setLayout(layout0);
			
			panel71 = new JPanel();
			panel71.setLocation(new IntPoint(18, 5));
			panel71.setSize(new IntDimension(99, 200));
			panel71.setPreferredSize(new IntDimension(99, 200));
			var layout1:GridLayout = new GridLayout();
			layout1.setRows(10);
			layout1.setColumns(1);
			layout1.setHgap(0);
			layout1.setVgap(1);
			panel71.setLayout(layout1);
			
			_btn_line0 = new JButton();
			_btn_line0.setSize(new IntDimension(99, 19));
			_btn_line0.setText("label");
			
			_btn_line1 = new JButton();
			_btn_line1.setLocation(new IntPoint(0, 20));
			_btn_line1.setSize(new IntDimension(99, 19));
			_btn_line1.setText("label");
			
			_btn_line2 = new JButton();
			_btn_line2.setLocation(new IntPoint(0, 40));
			_btn_line2.setSize(new IntDimension(99, 19));
			_btn_line2.setText("label");
			
			_btn_line3 = new JButton();
			_btn_line3.setLocation(new IntPoint(0, 60));
			_btn_line3.setSize(new IntDimension(99, 19));
			_btn_line3.setText("label");
			
			_btn_line4 = new JButton();
			_btn_line4.setLocation(new IntPoint(0, 80));
			_btn_line4.setSize(new IntDimension(99, 19));
			_btn_line4.setText("label");
			
			_btn_line5 = new JButton();
			_btn_line5.setLocation(new IntPoint(0, 100));
			_btn_line5.setSize(new IntDimension(99, 19));
			_btn_line5.setText("label");
			
			_btn_line6 = new JButton();
			_btn_line6.setLocation(new IntPoint(0, 120));
			_btn_line6.setSize(new IntDimension(99, 19));
			_btn_line6.setText("label");
			
			_btn_line7 = new JButton();
			_btn_line7.setLocation(new IntPoint(0, 140));
			_btn_line7.setSize(new IntDimension(99, 19));
			_btn_line7.setText("label");
			
			_btn_line8 = new JButton();
			_btn_line8.setLocation(new IntPoint(0, 160));
			_btn_line8.setSize(new IntDimension(99, 19));
			_btn_line8.setText("label");
			
			_btn_line9 = new JButton();
			_btn_line9.setLocation(new IntPoint(0, 180));
			_btn_line9.setSize(new IntDimension(99, 19));
			_btn_line9.setText("label");
			
			panel74 = new JPanel();
			panel74.setLocation(new IntPoint(0, 227));
			panel74.setSize(new IntDimension(136, 25));
			panel74.setPreferredSize(new IntDimension(136, 25));
			var layout2:FlowLayout = new FlowLayout();
			layout2.setAlignment(AsWingConstants.CENTER);
			layout2.setHgap(4);
			layout2.setVgap(0);
			panel74.setLayout(layout2);
			
			btn_line_auto = new JButton();
			btn_line_auto.setLocation(new IntPoint(18, 0));
			btn_line_auto.setSize(new IntDimension(49, 25));
			btn_line_auto.setPreferredSize(new IntDimension(49, 25));
			btn_line_auto.setText("label");
			
			btn_line_cancel = new JButton();
			btn_line_cancel.setLocation(new IntPoint(70, 0));
			btn_line_cancel.setSize(new IntDimension(49, 25));
			btn_line_cancel.setPreferredSize(new IntDimension(49, 25));
			btn_line_cancel.setText("label");
			
			//component layoution
			getContentPane().append(panel71);
			getContentPane().append(panel74);
			
			panel71.append(_btn_line0);
			panel71.append(_btn_line1);
			panel71.append(_btn_line2);
			panel71.append(_btn_line3);
			panel71.append(_btn_line4);
			panel71.append(_btn_line5);
			panel71.append(_btn_line6);
			panel71.append(_btn_line7);
			panel71.append(_btn_line8);
			panel71.append(_btn_line9);
			
			panel74.append(btn_line_auto);
			panel74.append(btn_line_cancel);
			
			
			//-----------------------------------------------
			//var filter:GlowFilter;
			//filter = new GlowFilter(0x000000, 1, 2, 2, 100);
			
			
			
			btn_line_auto.addActionListener(onAuto);
			btn_line_cancel.addActionListener(onCancel);
			
			btn_line_auto.wrapSimpleButton(Client.getUIElement("btn_line_auto") as SimpleButton);
			btn_line_cancel.wrapSimpleButton(Client.getUIElement("btn_line_cancel") as SimpleButton);
			btn_line_auto.setText("");
			btn_line_cancel.setText("");
			
			/*var _btn_line1:JButton = new JButton();//'取消'
			_btn_line1.addActionListener(onLine1);
			_btn_line1.wrapSimpleButton(Client.getUIElement("btn_line") as SimpleButton);
			_btn_line1.setText("1线(正常)")
			_btn_line1.setTextFilters(new Array(filter));
			
			var _btn_line2:JButton = new JButton();//'取消'
			_btn_line2.addActionListener(onLine2);
			_btn_line2.wrapSimpleButton(Client.getUIElement("btn_line") as SimpleButton);
			_btn_line2.setText("2线(正常)")
			_btn_line2.setTextFilters(new Array(filter));
			
			var _btn_line3:JButton = new JButton();//'取消'
			_btn_line3.addActionListener(onLine3);
			_btn_line3.wrapSimpleButton(Client.getUIElement("btn_line") as SimpleButton);
			_btn_line3.setText("3线(正常)")
			_btn_line3.setTextFilters(new Array(filter));
			
			var _btn_line4:JButton = new JButton();//'取消'
			_btn_line4.addActionListener(onLine4);
			_btn_line4.wrapSimpleButton(Client.getUIElement("btn_line") as SimpleButton);
			_btn_line4.setText("4线(正常)")
			_btn_line4.setTextFilters(new Array(filter));
			
			var _btn_line5:JButton = new JButton();//'取消'
			_btn_line5.addActionListener(onLine5);
			_btn_line5.wrapSimpleButton(Client.getUIElement("btn_line") as SimpleButton);
			_btn_line5.setText("5线(正常)")
			_btn_line5.setTextFilters(new Array(filter));*/
			
			_btn_line0.addActionListener(onLine1);
			_btn_line1.addActionListener(onLine2);
			_btn_line2.addActionListener(onLine3);
			_btn_line3.addActionListener(onLine4);
			_btn_line4.addActionListener(onLine5);
			
			_btn_line5.addActionListener(onLine6);
			_btn_line6.addActionListener(onLine7);
			_btn_line7.addActionListener(onLine8);
			_btn_line8.addActionListener(onLine9);
			_btn_line9.addActionListener(onLine10);

			_btn_line0.setText("1线(正常)");
			_btn_line1.setText("2线(正常)");
			_btn_line2.setText("3线(正常)");
			_btn_line3.setText("4线(正常)");
			_btn_line4.setText("5线(正常)");
			
			_btn_line5.setText("6线(正常)");
			_btn_line6.setText("7线(正常)");
			_btn_line7.setText("8线(正常)");
			_btn_line8.setText("9线(正常)");
			_btn_line9.setText("10线(正常)");
			
			_btn_line5.setEnabled(false);
			_btn_line6.setEnabled(false);
			_btn_line7.setEnabled(false);
			_btn_line8.setEnabled(false);
			_btn_line9.setEnabled(false);
			
			var img_line_background:DisplayObject = Client.getUIElement("img_line_bg") as DisplayObject
			setBackgroundDecorator(new AssetBackground(img_line_background));
			setSizeWH(img_line_background.width,img_line_background.height);
			setLocationXY((Engine.W - img_line_background.width-5) / 2,(Engine.H - img_line_background.height-5)/2);
			btn_line_auto.setEnabled(false);
			
			_btn_line0.setForeground(ASColor.WHITE);
			_btn_line0.wrapSimpleButton(Client.getUIElement("btn_line_item") as SimpleButton);
			_btn_line0.setBackground(ASColor.GRAY);
			
			_btn_line1.setForeground(ASColor.WHITE);
			_btn_line1.wrapSimpleButton(Client.getUIElement("btn_line_item") as SimpleButton);
			_btn_line1.setBackground(ASColor.GRAY);

			_btn_line2.setForeground(ASColor.WHITE);
			_btn_line2.wrapSimpleButton(Client.getUIElement("btn_line_item") as SimpleButton);
			_btn_line2.setBackground(ASColor.GRAY);

			_btn_line3.setForeground(ASColor.WHITE);
			_btn_line3.wrapSimpleButton(Client.getUIElement("btn_line_item") as SimpleButton);
			_btn_line3.setBackground(ASColor.GRAY);
			
			_btn_line4.setForeground(ASColor.WHITE);
			_btn_line4.wrapSimpleButton(Client.getUIElement("btn_line_item") as SimpleButton);
			_btn_line4.setBackground(ASColor.GRAY);
			
			_btn_line5.setForeground(ASColor.WHITE);
			_btn_line5.wrapSimpleButton(Client.getUIElement("btn_line_item") as SimpleButton);
			_btn_line5.setBackground(ASColor.GRAY);
			
			_btn_line6.setForeground(ASColor.WHITE);
			_btn_line6.wrapSimpleButton(Client.getUIElement("btn_line_item") as SimpleButton);
			_btn_line6.setBackground(ASColor.GRAY);
			
			_btn_line7.setForeground(ASColor.WHITE);
			_btn_line7.wrapSimpleButton(Client.getUIElement("btn_line_item") as SimpleButton);
			_btn_line7.setBackground(ASColor.GRAY);
			
			_btn_line8.setForeground(ASColor.WHITE);
			_btn_line8.wrapSimpleButton(Client.getUIElement("btn_line_item") as SimpleButton);
			_btn_line8.setBackground(ASColor.GRAY);
			
			_btn_line9.setForeground(ASColor.WHITE);
			_btn_line9.wrapSimpleButton(Client.getUIElement("btn_line_item") as SimpleButton);
			_btn_line9.setBackground(ASColor.GRAY);
			
			var filter:GlowFilter = new GlowFilter(ASColor.BLACK.getARGB(), 1, 2, 2, 100);
			_btn_line0.filters = new Array(filter);
			_btn_line1.filters = new Array(filter);
			_btn_line2.filters = new Array(filter);
			_btn_line3.filters = new Array(filter);
			_btn_line4.filters = new Array(filter);
			_btn_line5.filters = new Array(filter);
			_btn_line6.filters = new Array(filter);
			_btn_line7.filters = new Array(filter);
			_btn_line8.filters = new Array(filter);
			_btn_line9.filters = new Array(filter);
		}

		protected function onAuto(e:Event):void
		{
			closeReleased();
		}
		protected function onCancel(e:Event):void
		{
			closeReleased();
		}
		protected function onLine1(e:Event):void
		{
			Client.getInstance().sendPacketLogic(9,[CharInfo.mapId,1,CharInfo.mapType,CharInfo.mapOwnerId,CharInfo.mapX,CharInfo.mapY]);
			closeReleased();
		}
		protected function onLine2(e:Event):void
		{
			Client.getInstance().sendPacketLogic(9,[CharInfo.mapId,2,CharInfo.mapType,CharInfo.mapOwnerId,CharInfo.mapX,CharInfo.mapY]);
			closeReleased();
		}
		protected function onLine3(e:Event):void
		{
			Client.getInstance().sendPacketLogic(9,[CharInfo.mapId,3,CharInfo.mapType,CharInfo.mapOwnerId,CharInfo.mapX,CharInfo.mapY]);
			closeReleased();
		}
		protected function onLine4(e:Event):void
		{
			Client.getInstance().sendPacketLogic(9,[CharInfo.mapId,4,CharInfo.mapType,CharInfo.mapOwnerId,CharInfo.mapX,CharInfo.mapY]);
			closeReleased();
		}
		protected function onLine5(e:Event):void
		{
			Client.getInstance().sendPacketLogic(9,[CharInfo.mapId,5,CharInfo.mapType,CharInfo.mapOwnerId,CharInfo.mapX,CharInfo.mapY]);
			closeReleased();
		}
		protected function onLine6(e:Event):void
		{
			Client.getInstance().sendPacketLogic(9,[CharInfo.mapId,6,CharInfo.mapType,CharInfo.mapOwnerId,CharInfo.mapX,CharInfo.mapY]);
			closeReleased();
		}
		protected function onLine7(e:Event):void
		{
			Client.getInstance().sendPacketLogic(9,[CharInfo.mapId,7,CharInfo.mapType,CharInfo.mapOwnerId,CharInfo.mapX,CharInfo.mapY]);
			closeReleased();
		}
		protected function onLine8(e:Event):void
		{
			Client.getInstance().sendPacketLogic(9,[CharInfo.mapId,8,CharInfo.mapType,CharInfo.mapOwnerId,CharInfo.mapX,CharInfo.mapY]);
			closeReleased();
		}
		protected function onLine9(e:Event):void
		{
			Client.getInstance().sendPacketLogic(9,[CharInfo.mapId,9,CharInfo.mapType,CharInfo.mapOwnerId,CharInfo.mapX,CharInfo.mapY]);
			closeReleased();
		}
		protected function onLine10(e:Event):void
		{
			Client.getInstance().sendPacketLogic(9,[CharInfo.mapId,10,CharInfo.mapType,CharInfo.mapOwnerId,CharInfo.mapX,CharInfo.mapY]);
			closeReleased();
		}
		
		public static var _frame:FrameSelectLine = null;
		public static function show():void
		{
			if(isShowing())
			{
				hide();
				return;
			}
			if(_frame == null)
			{
				_frame = new FrameSelectLine();
				PanelMainHelp.getInstance().addChild(_frame);
			}
			_frame.show();
			PanelMainHelp.getInstance().bringToTop(_frame);
			_frame.setLocationXY((Engine.W - _frame.width)/2,(Engine.H - _frame.height)/2);
			
		}
		public static function hide():void
		{
			if(isShowing())_frame.hide();
		}
		public static function isShowing():Boolean
		{
			return(_frame != null&& _frame.isShowing());
		}
	}
}